Algorithm to Rotate an Ellipse

These instructions are to rotate an ellipse that is centered at the origin and of the form $$\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}=1,\qquad a>b$$ 1. Algebraically change the equation form to be $\lambda_{1}x^{2}+\lambda_{2}y=1$. This will be the same as $$\frac{1}{a^{2}}x^{2}+\frac{1}{b^{2}}y^{2}=1.$$ Since $a^{2}>b^{2},\lambda_{1}<\lambda_{2}$. The smaller eigenvalue will always represent the semi-major axis.

2. Create a diagonal matrix from the eigenvalues. $$\mathbf{D}=\left(\begin{array}{cc} \lambda_{1} & 0\\ 0 & \lambda_{2} \end{array}\right)$$ 3. Obtain an eigenvector for the semi-major axis and name it $\mathbf{u}=\left(\begin{array}{c} u_{x}\\ u_{y} \end{array}\right)$. This will be an eigenvector by definition of what we are doing. It isn't derived. It is given. For example, if we wanted to rotate $30^{\circ}$ counterclockwise, then $\hat{\mathbf{u}}=\left(\cos(\pi/6),\sin(\pi/6)\right)$.

4. The semi-minor axis eigenvector will be $\mathbf{v}=\left(\begin{array}{c} u_{y}\\ -u_{x} \end{array}\right)=\left(\begin{array}{c} v_{x}\\ v_{y} \end{array}\right)$. These two vectors, $\mathbf{u}$ and $\mathbf{v}$, determine the rotation. They do not need to be unit vectors. (But, if not then you will have to find a matrix inverse.)

5. Create a change of basis matrix. $$\mathbf{S}=\left(\begin{array}{cc} u_{x} & v_{x}\\ u_{y} & v_{y} \end{array}\right)$$

6. Create a matrix, $\mathbf{A}$, that is in “quadratic form”. $$\mathbf{A}=\mathbf{S\cdot D\cdot S^{-1}}$$ Notice that $\mathbf{S}=\mathbf{S^{-1}=}Transpose(\mathbf{S})$ iff $\mathbf{S}$ is normalized as a unit vector. This is the only reason that you might want to make $\mathbf{S}$ a unit vector because a transpose is easier than finding the inverse. $$\mathbf{A}=\left(\begin{array}{cc} a' & \frac{b'}{2}\\ \frac{b'}{2} & c' \end{array}\right)$$ 7. Write the newly rotated equation. $a'x^{2}+b'xy+c'y^{2}=1$

Example: Given an ellipse, $\frac{x^{2}}{36}+\frac{y^{2}}{14}=1$, write the equation of the ellipse that has the same axes lengths but is rotated to have its long axis on the line $y=\frac{5}{2}x$.